package com.hzgj.bcl.soa.spi;

import com.hzgj.bcl.soa.rpc.client.RequestOptions;
import com.hzgj.bcl.soa.rpc.message.Message;

import java.lang.reflect.Method;
import java.util.Map;

/**
 * Created by warning on 2016/11/4.
 */
public interface MessageHandleFactory {

    Message buildRequestMessage(Method method, Object[] args, RequestOptions options);

    Message buildResponse(Long req_id, Object reply, boolean is_exception);

    Message buildErrorResponse(Throwable throwable, Map<String, Object> headers);

    <T> T handleResponse(Object response) throws Exception;

    String getName();
}
